////////////////////////////////////////////////////////////////////////////////
// Filename: Scene.h
////////////////////////////////////////////////////////////////////////////////
#ifndef _SCENE_H_
#define _SCENE_H_



//////////////
// INCLUDES //
//////////////
#include <vector>
#include "Entity.h"
#include "Area.h"
#include "Character.h"

class Game;
class TiXmlElement;
class RenderItemManager;

class Scene
{
public:
	Scene();
	~Scene();

	bool Initialize();
	void LoadXML(const char * pDocument);
	Entity* ReadXmlEntity(TiXmlElement* entityElement);
	Character* ReadXmlCharacter(TiXmlElement* characterElement);
	void Uninit();
	void Update(int pElapsedTime);
	void PreRender();
	void Render();
	//void ShadowRender(ShadowMap* pShadowMap);

	Character* GetControledCharacter();
	Area* GetAreaById(int pId);

	void AddAreaInRendering(Area* pArea);
protected:
	void InitAreaInRenderingVector();
	void CalculateBoundingBox();
	void ComputeStopRenderArea();

	std::vector<Area*> mAreas;
	std::vector<Entity*> mEntities;
	std::vector<Character*> mCharacters;

	Game* mGame;
	Area* mFirstArea;
	Area* mCurrentArea;
	RenderItemManager* mRenderItemManager;

	int mAreasInRenderingCount;
	int mAreasInRenderingCountLastFrame;
	Area** mAreasInRendering;
	Area** mAreasInRenderingLastFrame;
};
#endif